#include "RecordInterface.h"
#include "Recorder.h"

namespace ScreenRecorderLib {
	public ref class RecorderInstance {
	private:
		RecorderInstance() {};
		static RecorderInstance m_instance;
	public:
		Recorder^ recorder;
		static property RecorderInstance^ instance
		{
			RecorderInstance^ get() { return % m_instance; }
		}
	};
}

using namespace ScreenRecorderLib;

void startRecord(const char* path, bool audio)
{
	RecorderOptions^ options = RecorderOptions::DefaultMainMonitor;
	if (audio) {
		options->AudioOptions->IsAudioEnabled = true;
		options->AudioOptions->IsInputDeviceEnabled = true;
	}
	RecorderInstance::instance->recorder = Recorder::CreateRecorder(options);
	RecorderInstance::instance->recorder->Record(gcnew String(path));
}

void stopRecord()
{
	RecorderInstance::instance->recorder->Stop();
}